<?php $this->import('Header') ?>
<div class="container">
	<div class="row register">
		<div class="col-xs-4 col-xs-offset-2">
			<form id="js-register-form">
				<h4>狗狗注册</h4>
				<div class="form-group">
					<div class="input-group">
						<div class="input-group-addon"><i class="glyphicon glyphicon-envelope"></i></div>
						<input type="text" name="email" class="form-control" placeholder="邮件">
					</div>
				</div>
				<div class="form-group">
					<div class="input-group">
						<div class="input-group-addon"><i class="glyphicon glyphicon-lock"></i></div>
						<input type="password" name="password" class="form-control" placeholder="密码">
					</div>
				</div>
				<div class="form-group">
					<span class="text-danger" id="error"></span>
				</div>
				<div class="form-group">
					<label><a href="">忘记密码？</a></label>
					<button class="btn btn-success"> 注册 </button>
				</div>
			</form>
		</div>
		<div class="col-xs-3 col-xs-4 col-xs-offset-1">
			<div>
				<h4>直接登录</h4>
				<a href="/OAuth/QQ?fromurl=<?php echo urlencode($fromUrl) ?>"><img src="/Resource/images/Connect_logo_5.png" width="150"></a>
				<br><br>
				<a href="/OAuth/Weibo?fromurl=<?php echo urlencode('/') ?>"><img src="/Resource/images/weibo_login.png" width="150"></a>
				<br><br>
				<p>已经有账号了? <a href="login.html">这里登录</a></p>
			</div>
		</div>
	</div>
</div>
<?php $this->import('Footer') ?>
<script>
	seajs.init({
		fromUrl: '<?php echo urlencode($fromUrl) ?>'
	});
	function register(obj) {
		$(obj).ajaxSubmit({
			url: '/Ajax/Passport/register?stmp=' + new Date().toDateString(),
			type: 'post',
			dataType: 'json',
			success: function(d) {
				if (d.error) {
					$('#error').html(d.data);
				} else {
					$('#error').html('您已注册成功，3秒后跳转登录业，点击马上跳转<a href="/login.html?fromurl=<?php echo urlencode($fromUrl) ?>">登录</a>');
					setTimeout(function() {
						window.location.href = '/login.html';
					}, 3000);
				}
			}
		});
		return false;
	}
</script>